<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <div id="app">
      <async-item></async-item>
  </div>
  <script src="js/vue.js"></script>
  <script>
    const app = Vue.createApp({
      data() {
        return {
          msg: '撩课学院'
        }
      }
    });
    // 注册一个全局异步组件
    // itlike002
    app.component('async-item', Vue.defineAsyncComponent(()=>{
       return new Promise((resolve, reject)=>{
          setTimeout(()=>{
             resolve({
               template: `<div style="width: 200px; height: 200px; background-color: red;">从服务端请求的异步组件</div>`
             })
          }, 3000);
       });
    }));
    app.mount('#app');
  </script>
</body>
</html>
